package pro.common.servlet;

import pro.wyn.JdbcUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(urlPatterns = "/wynuser/enable")
public class UserEnableServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //1.获取参数
        String id = request.getParameter("id");
        //2.执行SQL
        String sql="UPDATE `user` SET `disabled` = 0 WHERE id=?";
        //3.跳转到用户列表页
        JdbcUtils.modify(sql,id);
        response.sendRedirect("/wyn/user-list.jsp");
    }
}
